﻿// LogSystem.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include"const.h"
#include"Logger.h"

int main() {
    try {
        Logger logger("log.txt",true);

        logger.log(LogLevel::INFO,"Starting application.");

        int user_id = 42;
        std::string action = "login";
        double duration = 3.5;
        std::string world = "World";

        logger.log(LogLevel::INFO,"User {} performed {} in {} seconds.", user_id, action, duration);
        logger.log(LogLevel::DEBUG,"Hello {}", world);
        logger.log(LogLevel::WARN,"This is a message without placeholders.");
        logger.log(LogLevel::ERROR,"Multiple placeholders: {}, {}, {}.", 1, 2, 3);

        // 模拟一些延迟以确保后台线程处理完日志
        std::this_thread::sleep_for(std::chrono::seconds(1));
    }
    catch (const std::exception& ex) {
        std::cerr << "日志系统初始化失败: " << ex.what() << std::endl;
    }

    return 0;
}